package com.test.simplechat.model;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author wen
 * @param <T>
 */
public class WebChatModel<T> implements Serializable {
    private Integer onlineUserCount;
    private String fromId;
    private String toId;
    private T message;

    private String type;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Date currentTime;

    public WebChatModel() {
    }

    public WebChatModel(String fromId, String toId, T message, Integer onlineUserCount, String type) {
        this.fromId = fromId;
        this.toId = toId;
        this.message = message;
        this.onlineUserCount = onlineUserCount;
        this.currentTime = new Date();
        this.type = type;
    }

    public String getFromId() {
        return fromId;
    }

    public void setFromId(String fromId) {
        this.fromId = fromId;
    }

    public String getToId() {
        return toId;
    }

    public void setToId(String toId) {
        this.toId = toId;
    }

    public T getMessage() {
        return message;
    }

    public void setMessage(T message) {
        this.message = message;
    }

    public Date getCurrentTime() {
        return currentTime;
    }

    public void setCurrentTime(Date currentTime) {
        this.currentTime = currentTime;
    }

    public Integer getOnlineUserCount() {
        return onlineUserCount == null ? 0 : onlineUserCount;
    }

    public void setOnlineUserCount(Integer onlineUserCount) {
        this.onlineUserCount = onlineUserCount;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
